home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
dragan1r
/
tack.ctl
< prev
next >
Wrap
Text File
|
1999-07-15
|
4KB
|
124 lines
VERSION 5.00
Begin VB.UserControl PinTack
BorderStyle = 1 'Fixed Single
CanGetFocus = 0 'False
ClientHeight = 570
ClientLeft = 0
ClientTop = 0
ClientWidth = 285
ForwardFocus = -1 'True
ScaleHeight = 38
ScaleMode = 3 'Pixel
ScaleWidth = 19
ToolboxBitmap = "Tack.ctx":0000
Begin VB.Image imgNotOnTop
Height = 270
Left = 0
Picture = "Tack.ctx":0312
Top = 300
Visible = 0 'False
Width = 285
End
Begin VB.Image imgOnTop
Height = 270
Left = 0
Picture = "Tack.ctx":078C
Top = 0
Visible = 0 'False
Width = 285
End
End
Attribute VB_Name = "PinTack"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim ParentPosition As Integer
Enum Positions
Normal
On_Top
End Enum
Enum Borders
None
Fixed
End Enum
Event Change(NewPosition As Integer)
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Property Get FormPosition() As Positions
FormPosition = ParentPosition
End Property
Property Let FormPosition(NewPosition As Positions)
ParentPosition = NewPosition
PropertyChanged "FormPosition"
RaiseEvent Change(CInt(NewPosition))
ShowMode
End Property
Property Get BorderStyle() As Borders
BorderStyle = UserControl.BorderStyle
End Property
Property Let BorderStyle(NewStyle As Borders)
UserControl.BorderStyle = NewStyle
PropertyChanged "BorderStyle"
UserControl_Resize
End Property
Private Sub UserControl_Click()
FormPosition = Abs(ParentPosition - 1)
ShowMode
End Sub
Private Sub UserControl_InitProperties()
ShowMode
End Sub
Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent MouseDown(Button, Shift, ScaleX(X, ScaleMode, vbContainerPosition), ScaleY(Y, ScaleMode, vbContainerPosition))
End Sub
Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent MouseUp(Button, Shift, ScaleX(X, ScaleMode, vbContainerPosition), ScaleY(Y, ScaleMode, vbContainerPosition))
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
ParentPosition = PropBag.ReadProperty("FormPosition", 0)
UserControl.BorderStyle = PropBag.ReadProperty("BorderStyle", 0)
ShowMode
End Sub
Private Sub UserControl_Resize()
Static Started As Boolean
If Started = True Then Exit Sub
Started = True
Addition = UserControl.BorderStyle * UNIT_BORDER
UserControl.Height = ScaleY(Addition + UNIT_HEIGHT, 3, vbContainerPosition)
UserControl.Width = ScaleX(Addition + UNIT_WIDTH, 3, vbContainerPosition)
UserControl.Refresh
Started = False
End Sub
Sub ShowMode()
Select Case ParentPosition
Case Normal
Picture = imgNotOnTop
SetWindowPos Parent.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
Case On_Top
Picture = imgOnTop
SetWindowPos Parent.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
End Select
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "FormPosition", ParentPosition, 0
PropBag.WriteProperty "BorderStyle", UserControl.BorderStyle, 0
End Sub